float3 LightPosition : register(c0);
float3 AmbientColor : register(c1);
float3 DiffuseColor : register(c2);

texture2D Texture : register(t0);
sampler2D TextureSampler = sampler_state
{
	Texture = <Texture>;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = LINEAR;
};


void PSMain(
	float3 iPosition : TEXCOORD0,
	float3 iNormal : TEXCOORD1,
	float2 iTexCoord : TEXCOORD2,

	out float4 oColor : COLOR0 )
{
	float3 n = normalize(iNormal);
	float3 l = normalize(LightPosition - iPosition);
	float ln = saturate(dot(l, n));
	float3 c = AmbientColor + ln * DiffuseColor;

	oColor = float4(c, 1) * tex2D(TextureSampler, iTexCoord);
}
